
  <?php
    header("Content-Type:text/html;charset=utf-8");
    $name=$_POST["userName"];
    $pwd=$_POST["pwd"];
    $conn = mysql_connect("localhost","root","root");
    mysql_select_db('feiyadi');
    
    $result = mysql_query("select * from yonghu where username = '$name'",$conn);
    	if(mysql_num_rows($result) == 1){
    			echo "1";
    		}else{
    			echo "0";
    			mysql_query("insert into yonghu (username,userpassword) values ('$name',$pwd);",$conn);
    		}
		mysql_free_result($result);
    	mysql_close($conn);

    ?>